package com.hspedu.innerclass;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/1/28
 * @time 18:43
 */
public class InnerClassExercise02 {
    public static void main(String[] args) {
        Test test = new Test();
        new CellPhone().alarmClock(test);

        new CellPhone().alarmClock(new Bell() {
            @Override
            public void ring() {
                System.out.println("小伙伴上课了");
            }
        });
    }
}

interface Bell{void ring();}

class CellPhone{
    public void alarmClock(Bell bell){
        bell.ring();
    }
}

class Test implements Bell{
    @Override
    public void ring() {
        System.out.println("懒猪起床了");
    }
}